package com.hyzh.latte.vehicle.config;

import io.minio.MinioClient;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

/**
 * @author: songkui
 * @since: 2024/3/15 01:11
 */
@Getter
@Setter
@Validated
@Component
@Configuration
public class MinioConfig {
        @Value("${mocha.minio.endpoint}")
        private String endpoint;

        @Value("${mocha.minio.access}")
        private String access;

        @Value("${mocha.minio.secret}")
        private String secret;

        @Value("${mocha.minio.path}")
        private String path;

        @Bean
        public MinioClient minioClient(){
                return MinioClient.builder()
                        .endpoint(endpoint)
                        .credentials(access, secret)
                        .build();
        }

}
